package org.sparkle.html.impl.basic;

import java.util.List;

import org.sparkle.html.api.AbstractHtmlElement;
import org.sparkle.html.api.JScript;

public class Script extends AbstractHtmlElement {

	/**
	 * 
	 */
	private static final long serialVersionUID = 2730141315706477501L;

	public Script() {
		addAttr("type", "text/javascript");
		//removeAttr("id");
		removeAttr("class");
	}

	public Script(List<JScript> scripts) {
		this();
		String result = "$(document).ready(function(){ var bodyVar=$(\"body\");";
		for (JScript script : scripts) {
			result += script.getScript();
		}
		result += "});";
		setText(result);
	}

}
